import re
import os


reg = re.compile("^[a-zA-Z]+$")
print(reg.match("dadasdfd23"))
v = "lalla"
s = "sdsdsd$var$哈哈哈哈$var$ "
print(s.replace("$var$",""))


#os.startfile("E:\H5Game\Client")

arr = [1,2,3,4]
print(arr.index(3))
print(os.path.join("assets"))

root = os.path.split(__file__)[0]


clsName = "BasePanel"
n = len(clsName)
for i in range(n):
    idx = n-i-1
    char = clsName[idx]
    print("i",clsName[n-i-1])
    if char.istitle():
        clsName = clsName[idx:]
        print("clsName",clsName)
        break

regFnName = re.compile(r"#[a-zA-Z0-9_]+#")
#regFnName = re.compile("protected")
fnStr = "protected #onGUIBtnClick#(e:egret.TouchEvent):"
mobj = regFnName.search(fnStr)
print(mobj)
print(mobj.group())

arr = "txtDesc".split("_")
arr2  = list(map(lambda x: x.title(),arr))
arr2[0] = arr2[0].lower()
print(arr2,arr,"".join(arr2))

verStr = '''
StringFileInfo(
      [
      StringTable(
        u'040904B0',
        [StringStruct(u'CompanyName', u'kungfu'),
        StringStruct(u'FileDescription', u'H5工具集'),
        StringStruct(u'FileVersion', u'1.0.0.3 (win7_rtm.090713-1255)'),
        StringStruct(u'InternalName', u'amazing.EXE'),
        StringStruct(u'LegalCopyright', u'© 2018 kungfu'),
        StringStruct(u'OriginalFilename', u'amazing.EXE'),
        StringStruct(u'ProductName', u'H5 GUI工具'),
        StringStruct(u'ProductVersion', u'1.0.0.0')])
      ]), 
    VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
'''

reg = re.compile(r"StringTable\([\s\S]+?\]\)\,")
mobj = reg.search(verStr)
print(mobj.group())

def cmpFn(x):
  retArr = [int(i) for i in str(x)]
  n = len(str(x))
  retArr.append(n)  
  print("cmp",retArr)
  return retArr

def getMaxNum(numList):
  arr = list(numList)  
  arr.sort(key=cmpFn,reverse=True) 
  arr = list(map(lambda x:str(x),arr))
  ret = "".join(arr)  
  return int(ret)
# key接受的函数返回值，表示此元素的权值，sort将按照权值大小进行排序 返回可以是set list 
#print("ret",getMaxNum([13,312,343,5]))
#print("ret",getMaxNum([7,13,4,246]))
print("ret",getMaxNum([12,123]))
print("ret",getMaxNum([93,672,946,153,947,82,522,772,725,413,936,649,399,123,821,93,29,860,572,344,608,590,554,210,115,307,313,535,636,184,291,66,178,379,204,523,758]))

s1 = "9479469393936860828217727587256726664963660859057255453552352241339937934431330729291210204184178153123115" #正确
s2 = "9479469369393860828217727587256726664963660859057255453552352241339937934431330729291210204184178153123115"

import math
nstr = str(12321)
c = len(nstr)
flag = True
for i in range(c):
  last = c-i-1
  if last<i:    
    break
  elif nstr[i] != nstr[last]:
    flag = False    
    break
print("flag =",flag)

s="CopyHall"
print("re.split",re.split("[A-Z]",s))
sArr = s.split(" ")
sArr.reverse()
sArr = [ x for x in sArr]
print(" ".join(sArr),0%1000)

def fn():
  return 1,2,3,4

a,b,c,d = fn()
print("a,b,c,d=",a,b,c,d)

clsName = "CopyHall"
print(clsName.lower().find("module"))

if clsName.lower().find("module")!=-1:
  print("........")

regClsName = re.compile(r"^[a-zA-Z_]+[a-zA-Z_0-9]*$") 
clsname = "_Equd哈ds88ip484542"
mobj = regClsName.match(clsname)
print("mobj",mobj)

bstr = b'r7736 | lizhi | 2018-05-31 17:22:10 +0800 (\xd6\xdc\xcb\xc4, 31 \xce\xe5\xd4\xc2 2018) | 1 line\r\n'
bstr.decode()